package com.yanqu.road.server.cmd.activity.huashigang;

import com.yanqu.road.pb.huashigang.HuaShiGangProto;
import com.yanqu.road.server.cmd.CrossCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.manager.cross.battle.HuaShiGangMgr;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.CrossProtocol;

/**
 * @Author wpj
 * @Date 2020/10/17
 */
@Cmd(code = CrossProtocol.C2_HUA_SHI_GANG_HELPER_CODE, desc = "花石纲系统通知")
public class CrossHuaShiGangHelpCodeCmd extends CrossCommand {

    int activityId;
    int type;

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        HuaShiGangProto.HuaShiGangHelpCode msg = HuaShiGangProto.HuaShiGangHelpCode.parseFrom(packet.getBytes());
        activityId = msg.getActivityId();
        type = msg.getType();
        return true;
    }

    @Override
    public void execute(YanQuMessage packet) throws Exception {
        if (type == 1) {
            HuaShiGangMgr.reloadHuaShiGangConfig(activityId);
        } else if (type == 2) {
            HuaShiGangMgr.repair(activityId);
        }
    }

    @Override
    public void sendData() {

    }
}
